package com.taxshare.purchaser.controller;

import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.taxshare.mybatis.pager.PageRequest;
import com.taxshare.purchaser.service.InvoiceAuthService;
import com.taxshare.purchaser.service.InvoiceCollectionApplyService;
import com.taxshare.purchaser.view.dto.*;
import com.taxshare.purchaser.view.vo.AuthApplyInfoVO;
import com.taxshare.response.beans.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @ClassName: InvoiceAuthController
 * @Description:
 * @author: luozhongyi
 * @date: 2021/4/12 14:45
 */
@RestController
@RequestMapping(value = "/invoiceAuth")
@Api(tags = "发票认证")
public class InvoiceAuthController {

    @Autowired
    InvoiceAuthService invoiceAuth;
    @Autowired
    InvoiceCollectionApplyService invoiceCollectionApplyService;

//    @PostMapping("/auth")
//    @ApiOperation(value = "勾选发票认证", notes = "发票认证")
//    public Response invoiceAuth(@RequestBody InvoiceAuthModeDTO invoiceAuthModeDTO){
//        return invoiceAuth.invoiceAuth(invoiceAuthModeDTO);
//    }

    @PostMapping("/auth")
    @ApiOperation(value = "勾选发票认证", notes = "发票认证")
    public Response invoiceAuth(@RequestBody Map<String, Object> map){
        return invoiceAuth.invoiceAuth(map);
    }

    @PostMapping("/apply/info")
    @ApiOperation(value = "企业认证申请情况", notes = "企业认证申请情况")
    public Response<IPage<AuthApplyInfoVO>> authApplyInfo(@RequestBody PageRequest<AuthApplyInfoDTO> bean){
        return invoiceAuth.authApplyInfo(bean);
    }

    @PostMapping("/apply/submit")
    @ApiOperation(value = "发票认证提交申请", notes = "发票认证提交申请")
    public Response authApplySubmit(@RequestBody ApplyDTO bean){
        return invoiceAuth.authApplySubmit(bean);
    }

    @PostMapping("/apply/cancel")
    @ApiOperation(value = "发票认证撤销申请", notes = "发票认证撤销申请")
    public Response authApplyCancel(@RequestBody ApplyDTO bean){
        return invoiceAuth.authApplyCancel(bean);
    }

    @PostMapping("/apply/result")
    @ApiOperation(value = "发票认证申请/撤销情况", notes = "发票认证申请/撤销情况")
    public Response authApplyResult(@RequestBody ApplyResultDTO bean){
        return invoiceAuth.authApplyResult(bean);
    }

    @PostMapping("/apply/confirm")
    @ApiOperation(value = "发票认证申请签名确认", notes = "发票认证申请签名确认")
    public Response authApplyConfirm(@RequestBody ConfirmApplyDTO bean){
        return invoiceAuth.authApplyConfirm(bean);
    }

    @PostMapping("/apply/confirmResult")
    @ApiOperation(value = "发票认证申请签名确认结果", notes = "发票认证申请签名确认结果")
    public Response authApplyConfirmResult(@RequestBody ConfirmApplyResultDTO bean){
        return invoiceAuth.authApplyConfirmResult(bean);
    }
}
